#include<stdio.h>
#include<string.h>
#include<unistd.h>
#define NUM 100
int main()
{
  char bar[NUM + 1];
  memset(bar,'\0',sizeof(bar));
  int i = 0;
  const char* ch = "|/-\\";
  while(i<=NUM)
  {
    printf("[%-100s][%d%%]%c\r",bar,i,ch[i%4]);
    fflush(stdout);
    bar[i] = '#';
    i++;
    usleep(50000);
  }
  printf("\n");
  return 0;
}

